﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO.IsolatedStorage;

namespace FuelTracker.Utils
{
    public class IsolatedStorageUtils
    {

        public static void CreateDirectory(IsolatedStorageFile storage, string dirName)
        {
            try
            {
                if (!string.IsNullOrEmpty(dirName) && !storage.DirectoryExists(dirName))
                {
                    storage.CreateDirectory(dirName);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Couldn't create Directory in IsolatedStorage.", ex);
            }
        }


        public static void DeleteDirectory(IsolatedStorageFile storage, string dirName)
        {
            try
            {
                if (!string.IsNullOrEmpty(dirName) && storage.DirectoryExists(dirName))
                {
                    storage.DeleteDirectory(dirName);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Couldn't delete Directory in IsolatedStorage.", ex);
            }
        }

    }
}
